Skip to content

fix: nullable expiryDate, optional customer email, and doc corrections - #9

Merged
catsika merged 2 commits into
mainfrom
fix/types-and-docs
Nov 11, 2026
Merged

catsika merged 2 commits into
mainfrom
fix/types-and-docs

Conversation

@catsika

@catsika catsika commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

  • UpdateKeyParams.expiryDate is now string | null. null (or "") removes the key's expiry; omitting the field keeps it. The request body sends null as-is (axios does not drop it).
  • CreateKeyParams.maxActivations and UpdateKeyParams.maxActivations are number | string | null: a whole number 0–1,000,000 (number or digit string) or "unlimited"; null means unlimited and is sent as-is.
  • CreateCustomerParams.email is optional, matching POST /customer (only name is required).
  • getOrCreateInstallationId JSDoc no longer claims it throws when the file can't be written. It now says the write error is swallowed and an unsaved ID is returned. No behaviour change.
  • README: errors are not "returned"; methods reject with KeyMintApiError (the Error Handling section already shows branching on errorCode). The Idempotency section no longer says replays return floating-session secrets: the floating endpoints ignore Idempotency-Key. The floating methods' JSDoc says the same.

Tests

  • New contract tests: updateKey sends "expiryDate":null, updateKey omits expiryDate when unset, createCustomer works without email, createKey/updateKey send "maxActivations":null.
  • New type-level check tests/types/params.check.ts, run by npm test via npm run typecheck:tests. It fails against the old types.
  • npm run lint and npm test pass (57 tests). Live tests not run.

- UpdateKeyParams.expiryDate accepts null (or "") to remove the expiry;
  the request body keeps the null. Omitting it keeps the current expiry.
- CreateCustomerParams.email is optional, matching POST /customer.
- getOrCreateInstallationId JSDoc: a failed write is swallowed and an
  unsaved ID is returned instead of throwing. Behaviour is unchanged.
- README: methods reject with KeyMintApiError; floating endpoints ignore
  Idempotency-Key, so replays never return floating-session secrets.
- Tests: updateKey null/omitted expiryDate, createCustomer without email,
  and a type-level check run by npm test.
…pdateKey

A whole number 0-1,000,000 (number or digit string) or "unlimited";
null means unlimited and is sent as-is. Adds type-level checks and
contract tests for the null case.
@catsika
catsika merged commit ce44ecb into main Nov 11, 2026
3 checks passed
@catsika
catsika deleted the fix/types-and-docs branch November 11, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant